#pragma once
#include <stddef.h>
#include "Player.h"
#include "Board.h"

class DeepSearchPlayer: public Player {
public:
	class CandidateCell {
	public:
		int mColor;
		Board* mBoard;
		Cell* mCell;
		Board::State* mState;

	public:
		CandidateCell(int color, Board* board, Cell* cell, Board::State* state);
		~CandidateCell();
		bool isWideMarginWon(int color);
		string toString();
	};

private:

	static const int MAX_DEPTH = 3;
	int mDepth;
	int mMaxDepth;
	bool mNoGiveUp;
	Board* mMainBoard;
	int mMind;
protected:

public:
	DeepSearchPlayer(string name, Board* mainBoard = NULL, int depth = 0,
			int maxDepth = MAX_DEPTH);
	Cell* next();
	void setBoard(Board* board);
	void setNoGiveUp(bool noGiveUp);
	int hearMind();

private:
	CandidateCell* candidate(Cell* cell);
	CandidateCell* search(CandidateCell* candidateCell);
	void clear(vector<CandidateCell*>);
};

bool operator<(const DeepSearchPlayer::CandidateCell& riLeft, const DeepSearchPlayer::CandidateCell& riRight);
